import request from '@/utils/request'
import { httpAxios } from '../utils/request';

let PackageApi = {
    /*保存礼包*/
    savePackage(data, errorback) {
        return request._postBody('/shop/plus/package/add', data, errorback);
    },
    /*获取数据*/
    getData(data, errorback) {
        return request._post('/shop/plus/package/getGiftPackage', data, errorback);
    },
    /*保存礼包*/
    EditPackage(data, errorback) {
        return request._postBody('/shop/plus/package/edit', data, errorback);
    },
    /*列表*/
    packageList(data, errorback) {
        return request._postBody('/shop/plus/package/index', data, errorback);
    },
    /*发布礼包*/
    send(data, errorback) {
        return request._post('/shop/plus/package/send', data, errorback);
    },
    /*终止礼包*/
    end(data, errorback) {
        return request._post('/shop/plus/package/end', data, errorback);
    },
    /*删除*/
    delpackage(data, errorback) {
        return request._post('/shop/plus/package/delete', data, errorback);
    },
    /*订单*/
    orderlist(data, errorback) {
        return request._postBody('/shop/plus/package/orderList', data, errorback);
    },
    /*推广二维码*/
    qrcode(data, errorback) {
        return request._post('/shop/plus/package/qrcode', data, errorback);
    },
    getAllGrade(data,errorback) {
        return request._postBody('/shop/user/grade/getAllGrade', data, errorback);
    },
    getPagePacks(data,errorback) {
        return request._postBody('/shop/plus/vipPackage/index', data, errorback);
    },
    AddCouponPack(data,errorback) {
        return request._postBody('/shop/plus/vipPackage/add', data, errorback);
      },
      getCouponPackDetail(id,errorback) {
        return request._post('/shop/plus/vipPackage/detail?id='+id, {}, errorback);
      },
      updateCouponPack(data,errorback) {
        return request._postBody('/shop/plus/vipPackage/edit', data, errorback);
      },
      deleteCouponPack(id,errorback) {
        return request._post('/shop/plus/vipPackage/delete?id='+id, {}, errorback);
      },
      //券包购买记录列表 
      getCouponPackRecord(data,errorback) {
        return request._postBody('/shop/plus/vipPackage/buyRecordIndex', data, errorback);
      },
      getCouponPackRecordDetail(id,errorback) {
        return request._post('/shop/plus/vipPackage/buyRecordDetail?packageBuyRecordId='+id, {}, errorback);    
      },
      //导出券包购买记录 
      exportRecord() {
        return  httpAxios({
            url:'/shop/plus/vipPackage/export',
            responseType:'blob'
          })
        
      },
      writeOffRecord(data,errorback) {
        return request._postBody('/shop/plus/coupon/coupon/writeOffRecord', data, errorback);
      },
      getAllPackage(errorback) {
        return request._get('/shop/plus/vipPackage/list', {}, errorback);
      },
      sendPackage(data, errorback) {
        return request._postBody('/shop/plus/vipPackage/send', data , errorback);
      } 
}

export default PackageApi;
